# src/config.py

import toml

# Application metadata
VERSION = "Version: 0.5.2 | © 2025 MCMF, Fuzhou University"
CONTACT = "Email: wubo@fzu.edu.cn | Phone: +86 130 2381 9517"

DEFAULT_TEMPLATE = {
    "alloy_system": {
        "comps_file": "compositions.csv",
        "tdb_file": "example.TDB",
    },
    "output": {
        "output_root": "output",
    },
    "thermo_calc": {
        "tcp_path": "C:\\Program Files\\Thermo-Calc\\Thermo-Calc\\tc\\verp\\tcp.exe",
        "work_root": "C:\\tcp_runs",
    },
    "vmware": {
        "vmrun": "C:\\Program Files (x86)\\VMware\\VMware Workstation\\vmrun.exe",
        "vmx": "D:\\Documents\\VirtualMachines\\WinXPSP3\\WinXPSP3.vmx",
        "vm_user": "admin",
        "vm_passwd": "admin",
    },
}


def get_default_template():
    """Return default configuration dictionary (can be modified and written to file)"""
    return DEFAULT_TEMPLATE.copy()


def save_template(path: str, data=None):
    """Write template data to toml"""
    data = data or DEFAULT_TEMPLATE
    with open(path, "w", encoding="utf-8") as f:
        toml.dump(data, f)


if __name__ == "__main__":
    save_template("tcexp_cfg.toml")